package com.chandra.pos.customer.service.impl;

import com.chandra.pos.common.model.TransactionType;
import com.chandra.pos.customer.dao.entity.CustomerOrderEntity;
import com.chandra.pos.customer.dao.entity.CustomerPaymentEntity;
import com.chandra.pos.customer.dao.entity.TransactionEntity;
import com.chandra.pos.customer.model.*;
import com.chandra.pos.customer.service.CustomerManager;
import com.chandra.pos.customer.service.CustomerRole;
import com.chandra.pos.customer.service.TransactionRole;
import com.chandra.pos.payment.model.PaymentModel;
import com.chandra.pos.payment.service.PaymentRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;

import javax.persistence.EntityNotFoundException;
import javax.transaction.Transactional;

/**
 * Created by Admin on 7/3/14.
 */
@Service
public class CustomerManagerImpl implements CustomerManager {

    @Autowired
    CustomerRole customerRole;

    @Autowired
    private PaymentRole paymentRole;



    @Override
    public CustomerList search(CustomerFilter name) {
        return customerRole.search(name);
    }

    @Transactional
    public CustomerModel saveCustomer(CustomerModel customerModel) {
        return customerRole.saveCustomer(customerModel);
    }


    @Override
    public CustomerModel getCustomerDetail(CustomerFilter filter) throws EntityNotFoundException {
        return customerRole.getCustomerDetails(filter);
    }


}
